package com.codeoss.framework.view.renderer;

import org.springframework.stereotype.Service;

import com.codeoss.framework.context.YunContext;
import com.codeoss.framework.view.component.Component;
import com.codeoss.framework.view.component.chart.VBarChart;
import com.fasterxml.jackson.databind.node.ObjectNode;

@Service("vbarchartRenderer")
public class VBarChartRenderer extends AbstractChartRenderer {
	protected void startRenderView(YunContext yunContext, Component component, ViewSerializeMap viewSerializeMap) {
		super.startRenderView(yunContext, component, viewSerializeMap);
		VBarChart vBarChart = (VBarChart) component;
		viewSerializeMap.put("title", vBarChart.getTitle());
		viewSerializeMap.put("subtitle", vBarChart.getSubtitle());
		viewSerializeMap.put("col", vBarChart.getCol());
		viewSerializeMap.put("bigScreen", vBarChart.isBigScreen());
	}

	protected PropSerializeMap startRenderProp(YunContext yunContext, Component component, ViewPropMap viewPropMap) {
		PropSerializeMap propSerializeMap = super.startRenderProp(yunContext, component, viewPropMap);
		ObjectNode option = getRenderValue(yunContext, component);
		propSerializeMap.put("option", option);
		return propSerializeMap;
	}
}
